package com.alipear.uibase;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;

import com.alipear.appbase.BaseApp;

/**
 * Created by zoulinlin on 2015/4/2.
 */
public abstract class ExternBaseActivity implements ExternActivityInterface {
    // protected User user;
    protected String LOTT_CODE;
    protected Handler mBaseHandler;

    private boolean mbResumed = false;

    private final Activity mAcitivityOwner;

    public ExternBaseActivity(Activity owner) {
        mAcitivityOwner = owner;
    }

    @Override
    public void onResume() {
        mbResumed = true;
    }

    @Override
    public void onPause() {
        mbResumed = false;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        mBaseHandler = new Handler();
        BaseApp.getCurApp().addActivity(mAcitivityOwner);
    }

    @Override
    public void onDestroy() {
        BaseApp.getCurApp().removeActivity(mAcitivityOwner);
    }

    @Override
    public boolean isResume() {
        return mbResumed;
    }


    @Override
    public Handler getBaseHandler() {
        return mBaseHandler;
    }

    @Override
    public Activity getCurActivity() {
        return mAcitivityOwner;
    }


    @Override
    public Context getContext() {
        return mAcitivityOwner;
    }

}
